<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="Model.ConnectDatabase"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="Model.Mobile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="SHORTCUT ICON" href="image/shrotcuticon.png"></link>
         <title>Shop CH4</title>
        <script type="text/javascript" src="slide/scripts/jquery-1.4.3.min.js"></script>       
		<script type="text/javascript" src="css/jquery-ui-1.8.11.custom.min.js"></script>       
		<link type="text/css" href="css/jquery-ui-1.8.11.custom.css" rel="stylesheet" />
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" type="text/css" href="menu/menu_style.css" />
        <link rel="stylesheet" href="slide/nivo-slider.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="slide/style.css" type="text/css"/>
        <link type="text/css" href="css/style.css" rel="stylesheet" />
        <script type="text/javascript" src="slide/jquery.nivo.slider.pack.js"></script>
        <script type="text/javascript" src="menu/stmenu.js"></script>
         <script type="text/javascript" src="tooltip/jtip.js"></script>
        <link href="tooltip/css/global.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="validate.js"></script>

        <script type="text/javascript">
            $(window).load(
            function() {
                $('#slider').nivoSlider();
            }
        );
            $(document).ready(function() {
                $("form input").keypress(function (e) {
                    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
                        $("#btn_login").click();
                        return false;
                    } else {
                        return true;
                    }
                });
            });

            
        </script>
<script type="text/javascript">
   
    $(function(){
        // Tabs
        $('#tabs').tabs();
    });
    $("#post").click(function(){
        var mess=$("#body").val().replace(/^\s+|\s+$/, '');
        if(mess.length==0){
            alert("please enter some text");
        }
        else{
            //1 . lay id nguoi post
            //2 . lay noi dung
            //3 . gui len server
            //4 . nhan ket du lieu tra ve
            //5 . hien thi lai ket qua
            var noidung=$("#body").val();
            var datas='id='+id+'&'+'name='+name+'&'+'email='+email+'&'+'noidung='+noidung;
            $.ajax({
                type:"POST",
                url:"ControlYKienCaNhan",
                data:datas,
                cache:false,
                success:
                    function(html){
                    $("#tabs-2").prepend(html);
                    document.getElementById("body").value='';
                }
            });
        }
    }); //end post
</script>
<style type="text/css">
    /*demo page css*/
/*    body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}*/
    .demoHeaders { margin-top: 2em; }
    #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
    #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
    ul#icons {margin: 0; padding: 0;}
    ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
    ul#icons span.ui-icon {float: left; margin: 0 4px;}


</style>



<script type="text/javascript">
    function checkYKienCaNhan(){

        arr = new Array();
        var idname = document.getElementById('idname').value;
        var subname = document.getElementById('subname');

        //Check Name
        if(idname==''){
            subname.innerHTML=' Bạn Chưa Nhập Họ Tên ! ';
            arr[0] = 'false';
        }else{
            if(checkName(idname)==false){
                subname.innerHTML='Họ tên đã nhập không hợp lệ';
                arr[13] = 'false';
            }else{
                subname.innerHTML='';
            }
        }

        //Check Email
        var idemail = document.getElementById('idemail').value;
        var subemail = document.getElementById('subemail');
        if(idemail==''){
            subemail.innerHTML=' Bạn Chưa Nhập Email ! ';
            arr[4] = 'false';
        }else{
            if(isEmail(idemail)==false){
                subemail.innerHTML='Email Chưa Đúng Định Dạng';
                arr[5] = 'false';
            }else{
                subemail.innerHTML='';
            }
        }

        for(var i=0; i<arr.length;i++){
            if(arr[i]=='false'){
                return false;
            }
        }
    }
    function isEmail(str){
        var re =/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
        return re.test(str);
    }



    </head>


</script>
<%

		request.setCharacterEncoding("utf-8");
		Mobile mb = (Mobile) request.getAttribute("mobileID");
          
		
		String id = request.getParameter("id");
            if (id == null) {
                id = "";
            }
            String name = request.getParameter("name");
            if (name == null) {
                name = "";
            }
            String email = request.getParameter("email");
            if (email == null) {
                email = "";
            }
            String body = request.getParameter("body");
            if (body == null) {
                body = "";
            }

%>
 <body>
        <a name="top" id="top"></a>
        <div id="frame">
            <div id="page">
                <div id="header">
                    <%@include file="header.jsp"  %>
                    <%@include file="menu.jsp" %>

                </div>
                <!--        end header -->
                <div id="content">
                    <%@include file="leftpane.jsp"  %>
                    <!--end leftside -->
<div id="rightside">
    <%@include file="slide.jsp" %>

    <div id="boxrapidinfo" style="margin-left:5px;margin-top:50px;">
        <div class="box_header">
            <h4 class="title_center">CHI TIẾT SẢN PHẨM</h4>
        </div >
        <div class="box_center">
            <div id="infomobile">
                <div id="imagemobile">
                    <img src="<%=mb.getHinhAnh() %>" alt="" height="293" />                    </div>
                <div id="rapidinfo"><strong >
                        THÔNG TIN NHANH VỀ SẢN PHẨM </strong>
                </div>
                <ul>
                    <li>Tên sản phẩm: <%=mb.getTenSP()%></li>
                    <li>Giá cửa hàng: <strong><%=mb.getGiaBan()%></strong></li>
                    <li>Giá Online: <span class="style1"><%=mb.getGiaSauKhiGiam()%></span></li>
                    <li>Bảo hành : <%=mb.getThoiGianBaoHanh()%></li>
                    <li>Phụ kiện kèm theo: <%=mb.getPhuKienDiKem()%></li>
                  <!--   <li>Khuyến mại áp dụng tại: <%//= //mb.getDiscountPlace()%></li>--> 
                    <li>Thông tin nổi bật:<strong><%=mb.getThongTinNoiBat()%></strong></li>
                    <li>Tình trạng:  <%if (mb.getSoLuong() > 0) {
                                    out.print("Còn hàng");
                                } else {
                                    out.print("Hết hàng");
                                }%> </li>
                    <div align="center">
                        <a href="Order?mobileID=<%=mb.getMobileID()%>"><img src="image/bg-nutgiohang.png"
                                                                             border="0"  align="center" title="Thêm vào giỏ hàng"/></a>
                    </div>
                </ul>
            </div>
            <!--   end info mobile -->
            <div id="detailinfo">
                <div id="tabs">
                    <ul>
                        <li><a href="#tabs-1">THÔNG TIN CHI TIẾT SẢN PHẨM</a></li>
                        <li><a href="#tabs-2">Ý KIẾN CÁ NHÂN</a></li>
                    </ul>
                    <div id="tabs-1" >
                        <table bgcolor="#F6F6F6" width="100%" border="0" cellspacing="0" cellpadding="5">
                            <tr>
                                <th colspan="6" scope="col" align="left" bgcolor="#CCCCCC">THÔNG TIN CHI TIẾT SẢN PHẨM</th>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="5" width="30%">-   Thông tin chung:</td>
                            </tr>
                            <tr>
                                <td colspan="2" width="30%" > +Băng tần</td>
                                <td colspan="2" width="40%"><%=mb.getBangTan()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Kích thước</td>
                                <td colspan="2"><%=mb.getKichThuoc()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Trọng lượng</td>
                                <td colspan="2"><%=mb.getTrongLuong()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Màu</td>
                                <td colspan="2"><%=mb.getMauSac()%></td>
                            </tr>

                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="3">+Giao diện</td>
                                <td colspan="2">+ Độ phân giải màn hình</td>
                                <td colspan="2"><%=mb.getKichThuocManHinh()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Thông tin màn hình</td>
                                <td colspan="2"><%=mb.getThongTinManHinh()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Ngôn ngữ</td>
                                <td colspan="2"><%=mb.getNgonNgu()%></td>
                            </tr>
                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="3">- Âm   thanh: </td>
                                <td colspan="2">+ Chế độ rung</td>
                                <td colspan="2"><%=mb.getCheDoRung()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Nhạc chuông</td>
                                <td colspan="2"><%=mb.getNhacChuong()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Loa   ngoài</td>
                                <td colspan="2"><%=mb.getLoa()%></td>
                            </tr>
                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="7">- Kết   nối:</td>
                                <td colspan="2">+   GPRS</td>
                                <td colspan="2"><%=mb.getGprs()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   EDGE</td>
                                <td colspan="2"><%=mb.getEdge()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ 3G</td>
                                <td colspan="2"><%=mb.getG3()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   WLAN</td>
                                <td colspan="2"><%=mb.getWifi()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Bluetooth</td>
                                <td colspan="2"><%=mb.getBluetooth()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Hồng ngoại</td>
                                <td colspan="2"><%=mb.getHongNgoai()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ USB</td>
                                <td colspan="2"><%=mb.getUsb()%></td>
                            </tr>

                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="1">- CAMERA:</td>
                                <td colspan="2">+ Camera</td>
                                <td colspan="2"><%=mb.getCamera()%></td>
                            </tr>



                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan=10 >- Đặc tính:</td>
                                <td colspan="2">+ Hệ điều hành</td>
                                <td colspan="2"><%=mb.getHeDieuHanh().getTenHeDieuHanh()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ CPU</td>
                                <td colspan="2"><%=mb.getCpu()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Tin nhắn</td>
                                <td colspan="2"><%=mb.getSms()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Trình duyệt</td>
                                <td colspan="2"><%=mb.getTrinhDuyet()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Java</td>
                                <td colspan="2"><%=mb.getJava()%></td>
                            </tr>

                            <tr>
                                <td colspan="2">+ FM Radio</td>
                                <td colspan="2"><%=mb.getRadio()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Nghe nhạc</td>
                                <td colspan="2"><%=mb.getMusic()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Xem phim</td>
                                <td colspan="2"><%=mb.getVideo()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Tính năng văn phòng</td>
                                <td colspan="2"><%=mb.getOffice()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+ Tính năng khác</td>
                                <td colspan="2"><%=mb.getTinhNangKhac()%></td>
                            </tr>
                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="2" rowspan="2">-   Pin:</td>
                                <td colspan="2">+ Thời gian thoại</td>
                                <td colspan="2"><%=mb.getThoiGianThoai()%></td>
                            </tr>
                            <tr>
                                <td colspan="2">+   Thời gian chờ</td>
                                <td colspan="2"><%=mb.getThoiGianCho()%></td>
                            </tr>
                            <tr>
                                <td colspan="6">&nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right" valign="middle"><a href="#top"><img src="image/arrow_up.png" /></a></td>
                                <td align="left" valign="middle"><a href="#top">Về đầu trang</a></td>
                                <td align="right" valign="middle"><a href="javascript:window.print()"><img src="image/hp_printer.png" width="32" height="32" /></a></td>
                                <td align="left" valign="middle"><a href="javascript:window.print()">Tạo trang in</a></td>
                                <td align="right" valign="middle"><a href="index.jsp?contact"><img src="image/mail_orange.png" width="32" height="32" /></a></td>
                                <td align="left" valign="middle"><a href="index.jsp?contact">Ý kiến của bạn</a></td>
                            </tr>
                        </table>
                    </div>

                    <div id="tabs-2">

                        <%
                                    Connection con3 = ConnectDatabase.getConnection();
                                    Statement sta3 = con3.createStatement();
                                    String sql3 = "SELECT * FROM YKien where mobileid = " + mb.getMobileID();
                                    ResultSet re3 = sta3.executeQuery(sql3);
                                    while (re3.next()) {
                        %>
                        <table width="100%">
                            <tr>
                                <td><b><%=re3.getString(2)%></b>-<small><i><%=re3.getString(3)%></i></small></td>
                            </tr>
                            <tr>
                                <td><i><%=re3.getString(4)%></i></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                            <tr>
                                <td></td>
                            </tr>
                        </table>
                        <%}%>


                        <form action="ControlYKienCaNhan" method="post">
                            <table width="80%" >
                                <tr>
                                    <td width="20%"></td>
                                    <td width="30%"><input type="hidden" name="id" value="<%=mb.getMobileID()%>"><i></td>
                                    <td><f></span></sub></font></td>
                                    </tr>
                                    <tr>
                                        <td width="20%">HỌ VÀ TÊN :</td>
                                        <td width="30%"><input type="text" name="name" size="30" id="idname"></td>
                                        <td><font color="red"><sub><span id="subname"></span></sub></font></td>
                                    </tr>
                                    <tr>
                                        <td width="20%">EMAIL :</td>
                                        <td width="30%"><input type="text" name="email" size="30" id="idemail"></td>
                                        <td><font color="red"><sub><span id="subemail"></span></sub></font></td>
                                    </tr>

                            </table>
                            <table  width="50%">
                                <tr>
                                    <td colspan="2"><textarea name="body" cols="50" rows="5" id="idbody"></textarea></td>
                                </tr>
                            </table>
                            <table  width="50%">
                                <tr>
                                    <td><font color="red"><sub><span id="subbody"></span></sub></font></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td width="20%" align="right"><input type="submit" value="Ok" name="Ok" onclick="return checkYKienCaNhan()"></td>
                                </tr>
                            </table>
                        </form>
                    </div>


                </div>
            </div>
        </div>
        <!--              end box center -->


    </div>
    <!--            end rapid info -->







</div>

                    <!--        end rightside -->
                </div>
                <!--    end content -->
            </div>
            <%@include file="footer.jsp" %>
            <!--    end page -->
        </div>
</body>
</html>
